
#import <Cocoa/Cocoa.h>

#import "BWGrid.h" // for BWGrid_Square


extern NSString *BWBorkStitchDocument_StitchSelectionChangeNotification;

extern NSString *BWBorkStitchDocument_DocumentActivateNotification;
extern NSString *BWBorkStitchDocument_DocumentDeactivateNotification;

@class BWStitchView;
@class BWGrid;
@class BWStitch;
@class BWMOViewListView;
@class BWStitchArray;
@class BWStitchSelection;
 
@interface BWBorkStitchDocument : NSDocument
{
    BWGrid *grid;
    BWStitchArray *stitches;
    NSMutableArray *templateStitches; // ??? this is bizarre - kill me
    BWStitchSelection *selectedStitches;

    IBOutlet BWStitchView *stitchView;

    IBOutlet NSMatrix *toolMatrix;

    BOOL changeEverything;


    NSFont *labelFont;

    BOOL trackCenterOnly;

    BWGrid_Square printAreaAnchor1;
    BWGrid_Square printAreaAnchor2;

    NSRect loadedWindowBounds;

    IBOutlet NSButton *printableAreaCheckbox;
    IBOutlet NSButton *showBehindStitchesCheckbox;
    BOOL showBehindStitches;

    NSNotificationQueue *undoQueue;
    id notificationValue;
}

- (IBAction) handleToolPalette: (id) sender;
- (IBAction) frontBack: (id) sender;

- (IBAction) front1: (id) sender;
- (IBAction) back1: (id) sender;

- (IBAction) togglePrintableArea: (id) sender;

- (IBAction) borkstitchScaffolding: (id) sender;

- (IBAction) toggleShowBehindStitches: (id) sender;

- (IBAction) showInspector: (id) sender;


- (BWStitch *) targetStitch;
- (BWStitch *) templateStitch;
- (BWStitch *) selectedStitch;
- (NSArray *) templateStitches;
- (BWGrid *) grid;

- (void) setNeedsDisplay: (BOOL) yesNo;

// setLabelFont is in the undo code
- (NSFont *) labelFont;

- (BWStitchArray *) stitches;
- (BWStitchSelection *) selectedStitches;

- (void) unselectAll;

- (void) updateToolUI;

@end


